﻿using System;
using System.Collections.Generic;

namespace EcoSystem.Office.Excel
{
    /// <summary>
    /// 单元格验证数据项
    /// </summary>
    [Serializable]
    public class CellValidate
    {

        /// <summary>
        /// 下拉选项值
        /// </summary>
        public List<ExcelCellDropdownItem> Options { get; set; }

        /// <summary>
        /// 最小值
        /// </summary>
        public int Min { get; set; }

        /// <summary>
        /// 最大值
        /// </summary>
        public int Max { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public CellValidate()
        {
            Options = new List<ExcelCellDropdownItem>();
            //string[] arrs = new string[] { "贵阳", "安顺", "六盘水", "遵义", "黔南", "黔西南", "黔东南", "铜仁", "兴义" };
            ////
            //ISheet sheet = null;
            //XSSFDataValidationHelper helper = new XSSFDataValidationHelper((XSSFSheet)sheet);

            //CellRangeAddressList regions = new CellRangeAddressList(1, 65535, 0, 0);
            //IDataValidation validation = helper.CreateValidation(helper.CreateExplicitListConstraint(arrs), regions);//创建约束
            //validation.CreateErrorBox("错误", "输入值无效，请下拉选择正确的值!");//不符合约束时的提示  
            //validation.ShowErrorBox = true;//显示上面提示 = True  
            //sheet.AddValidationData(validation);//添加进去 

        }
    }
}
